function [ results ] = computeHogs( input )
load_settings;
% addpath(genpath('../vlfeat-0.9.16')); % call setup.m if you need to set
% this up

% Future: vectorize
disp('Compute_hogs: Calculating hog features');
for ix = 1:length(input)
    if ~isempty(input(ix).cam_id)
        fn = strcat(image_root, sprintf('%08d',input(ix).cam_id), '/', num2str(input(ix).day), '_', num2str(input(ix).hour, '%06d'), '.jpg');
        %disp(fn);
        img = imread(fn);
%         [iheight iwidth irgb] = size(img);
        
        for jx = 1:size(input(ix).bg_rects, 1)
            x = input(ix).bg_rects(jx,1);
            y = input(ix).bg_rects(jx,2);
            xx= x + input(ix).bg_rects(jx,3);
            yy= y + input(ix).bg_rects(jx,4);
            img_rectangle = img(y:yy, x:xx, :);
            img_rectangle = imresize(img_rectangle, reshape_size);
            hh = vl_hog(single(img_rectangle), binsize);
            input(ix).hog_dims = size(hh);
            input(ix).bg_hogs(jx,:) = reshape(hh, [size(hh,1)*size(hh,2)*size(hh,3), 1, 1]);
            input(ix).bg_rects(jx,:) = [x y xx-x yy-y];
        end
        
        for jx = 1:size(input(ix).ppl_rects, 1)
            x = input(ix).ppl_rects(jx,1);
            y = input(ix).ppl_rects(jx,2);
            xx= x + input(ix).ppl_rects(jx,3);
            yy= y + input(ix).ppl_rects(jx,4);
            
            img_rectangle = img(y:yy, x:xx, :);
            img_rectangle = imresize(img_rectangle, reshape_size);
            hh = vl_hog(single(img_rectangle), binsize);
            input(ix).hog_dims = size(hh);
            input(ix).ppl_hogs(jx,:) = reshape(hh, [size(hh,1)*size(hh,2)*size(hh,3), 1, 1]);
        end
    end
end
results = input;
disp('Compute_hogs: Done. ');
end

